<!DOCTYPE html>
<html>
<!-- Mirrored from /theme/hplus/table_jqgrid.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:20:02 GMT -->
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>产品编辑-乡土味士</title>
  <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
  <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">
  <link rel="shortcut icon" href="favicon.ico">
  <link href="http://news.xiangtws.com/__PUBLIC__/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
  <link href="__PUBLIC__/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
  <link href="__PUBLIC__/css/plugins/footable/footable.core.css" rel="stylesheet">
  <link href="__PUBLIC__/css/animate.min.css" rel="stylesheet">

  <link href="__PUBLIC__/css/plugins/summernote/summernote.css" rel="stylesheet">
  <link href="http://news.xiangtws.com/__PUBLIC__/css/plugins/summernote/summernote-bs3.css" rel="stylesheet">
  <link href="__PUBLIC__/css/style.min862f.css?v=4.1.0" rel="stylesheet">
  <script src="__PUBLIC__/js/jquery.min.js?v=2.1.4"></script>
  <script src="__PUBLIC__/js/bootstrap.min.js?v=3.3.6"></script>
  <script src="__PUBLIC__/js/plugins/footable/footable.all.min.js"></script>
  <script src="__PUBLIC__/js/content.min.js?v=1.0.0"></script>
  <script src="__PUBLIC__/js/plugins/summernote/summernote.min.js"></script>
  <script src="__PUBLIC__/js/plugins/summernote/summernote-zh-CN.js"></script>
  <!--日期显示插件-->
  <script src="__PUBLIC__/js/plugins/layer/laydate/laydate.js"></script>
  <style>
    /* Additional style to fix warning dialog position */
    #alertmod_table_list_2 {
      top: 900px !important;
    }
  </style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
  <div class="row">
    <div class="col-sm-12">
      <div class="ibox float-e-margins">
        <div class="ibox-title">
          <h5>编辑商品</h5>
        </div>
        <div class="ibox-content">
          <form method="post" class="form-horizontal">
            <div class="form-group">
              <label class="col-sm-2 control-label">标题</label>
              <div class="col-sm-5">
                <input type="text" name="title" placeholder="{$spellgroup['title']}" class="form-control">
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">发布人</label>
              <div class="col-sm-10">
                <div class="row">
                  <div class="col-md-3">
                    <select data-placeholder="选择用户" name="u_id" class="chosen-select form-control m-b" tabindex="2" style="width: 200px">
                      <option value="0">未绑定</option>
                      <volist name="list_member" id="vo">
                        <option value="{$vo.id}" hassubinfo="true" <?=$vo['id']==$spellgroup['u_id']?'selected':''?> >{$vo.id}-{$vo.nickname} </option>
                      </volist>
                    </select>
                  </div>
                </div>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">发布店铺</label>
              <div class="col-sm-10">
                <div class="row">
                  <div class="col-md-3">
                    <select data-placeholder="选择店铺" name="s_id" class="chosen-select form-control m-b" tabindex="2" style="width: 200px" disabled="">
                      <option value="0">未绑定</option>
                      <volist name="list_store" id="vo">
                        <option value="{$vo.id}" hassubinfo="true" <?=$vo['id']==$spellgroup['s_id']?'selected':''?> > {$vo.storename} </option>
                      </volist>
                    </select>
                  </div>
                </div>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">商品分类</label>
              <div class="col-md-1">
                <select data-placeholder="选择分类" name="type_id" class="chosen-select form-control m-b" tabindex="2" style="width: 200px">
                  <option value="0">未选择</option>
                  <volist name="type_category" id="vo">
                    <option value="{$vo.id}" hassubinfo="true" <?=$vo['id']==$spellgroup['type_id']?'selected':''?> > {$vo.title} </option>
                  </volist>
                </select>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">地标产品</label>
              <div class="col-md-2">
                <input type="text" name="type_name" placeholder="" value="{$spellgroup['type_name']}" class="form-control">
              </div>
            </div>
            <if condition="$spellgroup['type'] eq 0">
              <div class="form-group">
                <label class="col-sm-2 control-label">农户姓名</label>
                <div class="col-sm-2">
                  <input type="text" name="n_name" placeholder="" value="{$name}" class="form-control" disabled>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">产地</label>
                <div class="col-sm-5">
                  <input type="text" name="area" placeholder="" value="{$address}" class="form-control" disabled>
                </div>
              </div>
            </if>
            <div class="form-group">
              <label class="col-sm-2 control-label">拼团库存</label>
              <div class="col-md-2">
                <input type="text" name="num" placeholder="{$spellgroup['num']}" class="form-control">
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">几人成团</label>
              <div class="col-md-2">
                <input type="text" name="min_num" placeholder="{$spellgroup['min_num']}" class="form-control">
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">市场价/原价</label>
              <div class="col-md-2">
                <input type="number" name="price" placeholder="{$spellgroup['price']}" class="form-control" step="0.01">
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">规格数</label>
              <div class="col-md-2">
                <input type="number" name="u_num" placeholder="{$spellgroup['u_num']}" class="form-control">
              </div>
              <div class="col-md-1">
                <select data-placeholder="选择单位" name="unit" class="chosen-select form-control m-b" tabindex="2" style="width: 100px">
                  <option value="0">未选择</option>
                  <volist name="list_category" id="vo">
                    <option value="{$vo.id}" hassubinfo="true" <?=$vo['id']==$spellgroup['unit']?'selected':''?> > {$vo.title} </option>
                  </volist>
                </select>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">实际拼团份数</label>
              <div class="col-md-2">
                <input type="number" disabled name="actual_num" placeholder="{$spellgroup['actual_num']}" class="form-control">
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">拼团价</label>
              <div class="col-md-2">
                <input type="number" name="actual_price" placeholder="{$spellgroup['actual_price']}" class="form-control" step="0.01">
              </div>
            </div>
            <volist name="spellgroup['price_range']" id="vo">
              <div class="form-group">
                <label class="col-sm-2 control-label">批发价区间</label>
                <div class="col-md-6">
                  <input name="p_id[]" type="hidden" value="{$vo.id}">
                  <input style="width: 15%;float: left;margin-right: 10px;" name="start[]" value="{$vo.start}" type="number" placeholder="开始份数" class="form-control" step="0.01">
                  <p style="line-height: 30px;width: 20px;float: left">~</p>
                  <input style="width: 15%;float: left;margin-right: 20px;" name="end[]" value="{$vo.end}" type="number" placeholder="结束份数" class="form-control" step="0.01">
                  <input style="width: 15%;float: left;" type="number" name="p_price[]" value="{$vo.price}" placeholder="价位" class="form-control" step="0.01">
                </div>
              </div>
            </volist>
            <div class="form-group">
              <label class="col-sm-2 control-label">拼团活动时间</label>
              <div class="col-sm-10">
                <input class="form-control layer-date" name="starttime" placeholder="{$spellgroup['starttime']}" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
                <input class="form-control layer-date" name="endtime" placeholder="{$spellgroup['endtime']}" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">地址-详细地址</label>
              <div class="form-group">
                <div class="col-sm-8">
                  <input type="text" name="serve" placeholder="" value="<?=getarea($spellgroup['a_id_1']).getarea($spellgroup['a_id_2'])?>" class="form-control" disabled>
                </div>
              </div>
              <div class="form-group">
                <div col-sm-8>
                  <label class="col-sm-3 control-label">(一级)省：</label>
                  <div class="col-sm-5">
                    <select class="form-control select-1" name="a_id_1">
                      <option value="0">请选择</option>
                      <volist name="areali" id="vo">
                        <option value="{$vo.id}">{$vo.name}		编号:{$vo.area_id}（{$vo.id}）</option>
                      </volist>
                    </select>
                  </div>
                </div>
              </div>
              <div class="form-group">
                <div col-sm-8>
                  <label class="col-sm-3 control-label">(二级)市：</label>
                  <div class="col-sm-5">
                    <select class="form-control select-2" name="a_id_2">
                    </select>
                  </div>
                </div>
              </div>
            </div>

            <div class="form-group">
              <label class="col-sm-2 control-label">首页图片</label>
              <div class="col-sm-10">
                <volist name="spellgroup.h_img" id="vo">
                  <img height="100px" src="{$vo}" style="margin-right:8px;border: 1px #ccc solid;" />
              </volist>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">URL：</label>
              <div class="col-sm-10">
                <input class="form-control" name="h_imgs" value="{$spellgroup.h_imgs}" placeholder="首页图片链接,多个链接用英文逗号分离">
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">内容图片</label>
              <div class="col-sm-10">
                <volist name="spellgroup.c_img" id="vo">
                  <img height="100px" src="{$vo}" style="margin-right:8px;border: 1px #ccc solid;" />
                </volist>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">URL：</label>
              <div class="col-sm-10">
                <input class="form-control" name="c_imgs" value="{$spellgroup.c_imgs}" placeholder="内容图片链接,多个链接用英文逗号分离">
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">拼团须知</label>
              <div class="col-sm-10">
                <textarea name="server" style="width: 500px;height: 200px;resize:none;">{$spellgroup.server}</textarea>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">内容</label>
              <div class="col-sm-10">
                <div class="summernote">
                  {$spellgroup['content']}
                </div>
                <textarea name="content" style=" display:none;"></textarea>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">状态</label>
              <div class="col-sm-2">
                <select class="form-control m-b" name="state">
                  <option value="0">待审</option>
                  <option value="1">通过</option>
                  <option value="2">不通过</option>
                  <option value="3">删除</option>
                  <option value="4">结束</option>
                </select>
              </div>
            </div>
            <div class="form-group">
              <div class="col-sm-4 col-sm-offset-2">
                <button class="btn btn-primary" onClick="save()">保存</button>
                <button class="btn btn-white" type="button" onclick="window.location.href='__MODULE__/Spellgroup/index'">取消</button>
                <a class="btn btn-primary" onClick="clswidth()">清除图片宽</a>
                <a class="btn btn-primary" onClick="uploadimg()">上传图片</a>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
</div>
<!--五级地址联查-->
<script type="text/javascript">
    //一级
    $(".select-1").change(function(){

        //获取下一级所有地址
        $.ajax({
            type : "POST",
            dataType : "json",
            url: "__MODULE__/Area/getnext/rid/"+$(".select-1").val(),
            async:false,
            success: function(data){
                //展示下一级地区
                $(".select-2 option").remove();//移除所有option
                var instr="<option value='0'>请选择</option>";

                for(var i=0;i<data.length;i++){
                    instr+="<option value='"+data[i].id+"'>"+data[i].name+"		编号:"+data[i].area_id+"（"+data[i].id+"）"+"</option>";
                }//end for

                $(".select-2").append(instr);//添加新的option
            }
        });//end ajax
    });//end change
</script>
<script>
    // <!--富文本-->
    $(document).ready(function(){
        $(".summernote").summernote({lang:"zh-CN"});
        $(".note-editor").css("width","70%");
        $(".note-editor").css("float","left");
        $(".note-editable").css("height","308px");
    });
    var edit=function(){$("#eg").addClass("no-padding");$(".click2edit").summernote({lang:"zh-CN",focus:true})};var save=function(){$("#eg").removeClass("no-padding");var aHTML=$(".click2edit").code();$(".click2edit").destroy()};
</script>
<script>
    $("select[name='state'] option[value='"+"{$spellgroup['state']}"+"']").attr("selected","selected");
    function save(){
        //添加
        html=$(".note-editable").html();
        $("textarea[name='content']").text(html);
        document.getElementById("savearc").submit();
    }//end fun
    //清除插入的图片宽度
    function clswidth(){
        $(".note-editable").find("img").css('width','');

    }//end fun
    $.ajaxSetup({
        async : false
    });
    //上传图片
    function uploadimg() {
        $(".note-editable img").each(function (index,item) {
            var pic = $(item).attr('src');
            // // 判断图片地址是否包含base64字符串，包含则说明没有上传图片
            if(pic.indexOf("base64") >= 0 ) {
                $.post('http://imgs.xiangtws.com/Api/Index/uploadPic',{pic:pic,domain:'http://www.xiangtws.com'},function (data) {
                    $(item).attr('src',data);
                })
            }
        });
    }


</script>
</body>
<!-- Mirrored from /theme/hplus/table_jqgrid.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:20:02 GMT -->
</html>